<template>
  <div class="cart-list">
    <cart-list-item v-for="(item, index) in cartList" :key="index" :item-info="item"></cart-list-item>
  </div>
</template>

<script>
// vuex辅助函数解析getters为局部计算属性
import { mapGetters } from "vuex";

// 引入子组件
import CartListItem from "./CartListItem";

export default {
  name: "CartList",

  components: {
    CartListItem,
  },

  // 计算属性
  computed: {
    // 解析getters中的getter为当前组件计算属性
    ...mapGetters(["cartList"]),
  },
};
</script>

<style scoped>
</style>